package com.qf.smsplatform.strategy.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;
import java.util.Set;

/**
 * projectName: smsplatform
 *
 * @author: MaTianWei
 * time: 2021/8/12 21:04
 * description:缓存模块fegin接口
 */
@FeignClient(value = "sms-platform-cache")
public interface CacheClient {
    //根据key和field查询hash结构中的value
    @GetMapping("/cache/hget/{key}")
    String hget(@PathVariable String key, @RequestParam String field);

    //根据key查询key-string结构中的数据
    @RequestMapping(value = "/cache/get-object/{key}", method = RequestMethod.GET)
    String getObject(@PathVariable("key") String key);

    //根据key查询出全部的set集合中的信息
    @GetMapping("/cache/smembers/{key}")
    Set<Map> smembers(@PathVariable String key);

    //扣除hash结构中某一个field的value
    @PostMapping("/cache/hincr")
    Long hincr(@RequestParam String key, @RequestParam String field, @RequestParam long increment);
    //根据key查询出Value(黑名单)
    @GetMapping("/cache/get/{key}")
    String get(@PathVariable String key);
    //获取redis中的key
    @GetMapping("/cache/getkeys/{pre}")
    Set getKeys(@PathVariable String pre);
    //5分钟
    @GetMapping("/cache/zRangeByScore/{key}")
    int zRangeByScore(@PathVariable String key, @RequestParam long min, @RequestParam long max);
}
